<template>
  <span class="info m-l-30 pointer" @click="toggleDisplay">
    <svg-icon icon-name="gitlab_comments" />
    <template v-if="isCurFloor">收起评论</template>
    <template v-else>{{ item.subs }} 条评论</template>
  </span>
</template>

<script>
export default {
  name: 'list-toggle-button',
  props: {
    isCurFloor: Boolean,
    item: Object,
  },
  methods: {
    toggleDisplay() {
      this.reloadQuery(Object.assign({}, this.$route.query, {
        comment_id: this.isCurFloor ? undefined : this.item.id,
        sub_page: undefined, // 清空楼中楼的页数
      }));
      if (this.isCurFloor) this.$emit('close');
    },
  },
};
</script>

<style></style>
